<template>
  <div class="dashboard-container">

    <el-row style="padding: 20px" :gutter="20">
      <el-col :span="6">
        <div class="grid-content bg-purple">
          <svg-icon
            class="iconclass"
            icon-class="student"
          ></svg-icon>
          <span class="tips">学生数量：</span>
          <span class="nums">{{ studentcount }}</span>
        </div>
      </el-col>

      <el-col :span="6">
        <div class="grid-content bg-purple">
          <svg-icon
            class="iconclass"
            icon-class="classroom"
          ></svg-icon>
          <span class="tips">班级数量：</span>
          <span class="nums">{{ classroomcount }}</span>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content bg-purple">
          <svg-icon
            class="iconclass"
            icon-class="paper"
          ></svg-icon>
          <span class="tips">试卷数量：</span>
          <span class="nums">{{ papercount }}</span>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getDashboardInfo } from '@/api/teacher'

export default {
  name: 'dashboard',
  data() {
    return {

      studentcount: 0,
      papercount: 0,
      classroomcount: 0
    }
  },
  mounted() {
    this.getbaseinfo()
  },
  methods: {
    getbaseinfo() {
      getDashboardInfo().then(res=>{
        this.studentcount = res.studentcount;
        this.papercount = res.papercount;
        this.classroomcount = res.classroomcount;
        console.log(res)
      }).catch(err=>{
        console.log(err)
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.iconclass {
  font-size: 100px;
}

.tips {
  font-size: 20px;
}

.nums {
  font-size: 100px;
}

.el-row {
  margin-bottom: 20px;

  &:last-child {
    margin-bottom: 0;
  }
}

.el-col {
  border-radius: 4px;
}

.bg-purple-dark {
  background: #99a9bf;
  color: #1482f0;
}

.bg-purple {
  background: #d3dce6;
  color: #1a90ac;
}

.bg-purple-light {
  background: #e5e9f2;
  color: #4ed038;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}

.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>
